package com.moshang.blog.service;

import com.moshang.blog.entity.TblGreat;
import com.moshang.blog.entity.bo.LikeCount;

import java.util.List;

/**
 * @author xww
 * Created on 2019/4/25.
 */
public interface RedisService {
    /**
     * 点赞。状态为1
     * @param likedUserId
     * @param articleId
     */
    void saveLiked2Redis(Integer likedUserId, Integer articleId);
    /**
     * 取消点赞。将状态改变为0
     * @param likedUserId
     * @param articleId
     */
    void unlikeFromRedis(Integer likedUserId, Integer articleId);
    /**
     * 获取该用户改文章的点赞状态
     * @param likedUserId
     * @param articleId
     */
    Integer findLikedFromRedis(Integer likedUserId, Integer articleId);
    /**
     * 该文章的点赞数加1
     * @param articleId
     */
    void incrementLikedCount(Integer articleId);

    /**
     * 该文章的点赞数减1
     * @param articleId
     */
    void decrementLikedCount(Integer articleId);
    /**
     * 该文章的点赞总量
     * @param articleId
     */
    Integer findLikedCount(Integer articleId);
    /**
     * 获取Redis中存储的所有点赞数据
     * @return
     */
    List<TblGreat> getLikedDataFromRedis();

    /**
     * 获取Redis中存储的所有点赞总量
     * @return
     */
    List<LikeCount> getLikedCountFromRedis();
}
